package com.剑指offer;

import java.util.ArrayList;
import java.util.List;

public class _数组中重复的数字
{
    public static void main(String[] args)
    {
        int a[] = new int[]{1,2,3,3};
        System.out.println(findRepeatNumber(a));
    }

    public static int findRepeatNumber(int[] nums)
    {
        int len = nums.length;
        if (len < 2)
        {
            return 0;
        }
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < len; i++)
        {
            if (list.contains(nums[i]))
            {
                return nums[i];
            }else{
                list.add(nums[i]);
            }
        }
        return 0;

    }
}
